package com.yuanzong.wuliu.controller.admin.business.customer;

import com.yuanzong.wuliu.common.vo.ApiResult;
import com.yuanzong.wuliu.controller.admin.business.customer.param.*;
import com.yuanzong.wuliu.service.admin.business.customer.AdminBusinessCustomerDaijiaxianService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Api(tags = "管理端 - 客户代驾险")
@RequestMapping("/admin/business/customer/businessCustomerDaiJiaXian")
@Slf4j
public class AdminBusinessCustomerDaijiaxianController {

    @Autowired
    private AdminBusinessCustomerDaijiaxianService adminBusinessCustomerDaijiaxianService;

    @ApiOperation("分页")
    @RequestMapping(value = "/page", method = {RequestMethod.POST})
    public ApiResult page(@RequestBody AdminBusinessCustomerDaijiaxianPageParam param) throws Exception {
        ApiResult result = adminBusinessCustomerDaijiaxianService.page(param);
        return result;
    }

    @ApiOperation("保存")
    @RequestMapping(value = "/save", method = {RequestMethod.POST})
    public ApiResult save(@Valid @RequestBody AdminBusinessCustomerDaijiaxianSaveParam param) throws Exception{
        ApiResult result = adminBusinessCustomerDaijiaxianService.save(param);
        return result;
    }

    @ApiOperation("详情")
    @RequestMapping(value = "/info", method = {RequestMethod.POST})
    public ApiResult info(@Valid @RequestBody AdminBusinessCustomerDaijiaxianInfoParam param) throws Exception{
        ApiResult result = adminBusinessCustomerDaijiaxianService.info(param);
        return result;
    }

    @ApiOperation("删除")
    @RequestMapping(value = "/remove", method = {RequestMethod.POST})
    public ApiResult remove(@Valid @RequestBody AdminBusinessCustomerDaijiaxianRemoveParam param) throws Exception{
        ApiResult result = adminBusinessCustomerDaijiaxianService.remove(param);
        return result;
    }
}
